public class Floor {
	private static byte aByte310 = 6;
	public static int anInt313;
	public static Floor[] floors;
	public String aString315;
	public int anInt316;
	public int anInt317 = -1;
	public boolean aBoolean318 = false;
	public boolean aBoolean319 = true;
	public int anInt320;
	public int anInt321;
	public int anInt322;
	public int anInt323;
	public int anInt324;
	public int anInt325;

	public static void method207(Archive archive) {
			Packet packet = new Packet(archive.method154(
				"flo.dat", null));
			Floor.anInt313 = packet.getUShort();
			if (Floor.floors == null) {
				Floor.floors = new Floor[Floor.anInt313];
			}
			for (int i_0_ = 0; i_0_ < Floor.anInt313; i_0_++) {
				if (Floor.floors[i_0_] == null) {
					Floor.floors[i_0_] = new Floor();
				}
			Floor.floors[i_0_].method208(packet);
			}
	}

	public void method208(Packet packet) {
		for (;;) {
			int i_2_ = packet.getUByte();
			if (i_2_ == 0) {
				break;
			}
			if (i_2_ == 1) {
				anInt316 = packet.get24BitInt1();
				method209(anInt316);
			} else if (i_2_ == 2) {
				anInt317 = packet.getUByte();
			} else if (i_2_ == 3) {
				aBoolean318 = true;
			} else if (i_2_ == 5) {
				aBoolean319 = false;
			} else if (i_2_ == 6) {
				aString315 = packet.getString();
			} else if (i_2_ == 7) {
				int i_3_ = anInt320;
				int i_4_ = anInt321;
				int i_5_ = anInt322;
				int i_6_ = anInt323;
				int i_7_ = packet.get24BitInt1();
				method209(i_7_);
				anInt320 = i_3_;
				anInt321 = i_4_;
				anInt322 = i_5_;
				anInt323 = i_6_;
				anInt324 = i_6_;
			} else {
				System.out.println("Error unrecognised config code: " + i_2_);
			}
		}
	}

	private void method209(int i) {
		if (i == 16711935) {
			i = 0;
		}
		double d = (i >> 16 & 0xff) / 256.0;
		double d_8_ = (i >> 8 & 0xff) / 256.0;
		double d_9_ = (i & 0xff) / 256.0;
		double d_10_ = d;
		if (d_8_ < d_10_) {
			d_10_ = d_8_;
		}
		if (d_9_ < d_10_) {
			d_10_ = d_9_;
		}
		double d_11_ = d;
		if (d_8_ > d_11_) {
			d_11_ = d_8_;
		}
		if (d_9_ > d_11_) {
			d_11_ = d_9_;
		}
		double d_12_ = 0.0;
		double d_13_ = 0.0;
		double d_14_ = (d_10_ + d_11_) / 2.0;
		if (d_10_ != d_11_) {
			if (d_14_ < 0.5) {
				d_13_ = (d_11_ - d_10_) / (d_11_ + d_10_);
			}
			if (d_14_ >= 0.5) {
				d_13_ = (d_11_ - d_10_) / (2.0 - d_11_ - d_10_);
			}
			if (d == d_11_) {
				d_12_ = (d_8_ - d_9_) / (d_11_ - d_10_);
			} else if (d_8_ == d_11_) {
				d_12_ = 2.0 + (d_9_ - d) / (d_11_ - d_10_);
			} else if (d_9_ == d_11_) {
				d_12_ = 4.0 + (d - d_8_) / (d_11_ - d_10_);
			}
		}
		d_12_ /= 6.0;
		anInt320 = (int) (d_12_ * 256.0);
		anInt321 = (int) (d_13_ * 256.0);
		anInt322 = (int) (d_14_ * 256.0);
		if (anInt321 < 0) {
			anInt321 = 0;
		} else if (anInt321 > 255) {
			anInt321 = 255;
		}
		if (anInt322 < 0) {
			anInt322 = 0;
		} else if (anInt322 > 255) {
			anInt322 = 255;
		}
		if (d_14_ > 0.5) {
			anInt324 = (int) ((1.0 - d_14_) * d_13_ * 512.0);
		} else {
			anInt324 = (int) (d_14_ * d_13_ * 512.0);
		}
		if (anInt324 < 1) {
			anInt324 = 1;
		}
		anInt323 = (int) (d_12_ * anInt324);
		int i_15_ = anInt320 + (int) (Math.random() * 16.0) - 8;
		if (i_15_ < 0) {
			i_15_ = 0;
		} else if (i_15_ > 255) {
			i_15_ = 255;
		}
		int i_16_ = anInt321 + (int) (Math.random() * 48.0) - 24;
		if (i_16_ < 0) {
			i_16_ = 0;
		} else if (i_16_ > 255) {
			i_16_ = 255;
		}
		int i_17_ = anInt322 + (int) (Math.random() * 48.0) - 24;
		if (i_17_ < 0) {
			i_17_ = 0;
		} else if (i_17_ > 255) {
			i_17_ = 255;
		}
		anInt325 = method210(i_15_, i_16_, i_17_);
	}

	private final int method210(int i, int i_18_, int i_19_) {
		if (i_19_ > 179) {
			i_18_ /= 2;
		}
		if (i_19_ > 192) {
			i_18_ /= 2;
		}
		if (i_19_ > 217) {
			i_18_ /= 2;
		}
		if (i_19_ > 243) {
			i_18_ /= 2;
		}
		int i_20_ = (i / 4 << 10) + (i_18_ / 32 << 7) + i_19_ / 2;
		return i_20_;
	}
}
